/* 通用控件：按钮、输入、标签、开关、空态、加载 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--glass-edge);
  border-radius: 9px;
  background: var(--glass-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}

.btn[hidden] {
  display: none;
}

.btn:hover:not(:disabled) {
  border-color: rgba(16, 21, 38, .13);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

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

.btn-primary {
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 1px 2px rgba(29, 67, 204, .3), 0 8px 22px rgba(47, 95, 255, .26);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #3d6bff, #2246d6);
  box-shadow: 0 2px 4px rgba(29, 67, 204, .3), 0 14px 32px rgba(47, 95, 255, .34);
}

.btn-accent {
  border-color: transparent;
  background: var(--lemon);
  color: #1b2200;
  box-shadow: 0 1px 2px rgba(120, 140, 20, .22), 0 8px 22px rgba(216, 239, 74, .4);
}

.btn-accent:hover:not(:disabled) {
  background: #e2f65c;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, .7);
  box-shadow: none;
  transform: none;
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn-danger {
  color: var(--coral);
}

.btn-danger:hover:not(:disabled) {
  border-color: rgba(255, 106, 77, .34);
  background: rgba(255, 106, 77, .08);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}

.field-hint {
  color: var(--ink-4);
  font-size: 13px;
}

.input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--solid-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .86);
  color: var(--ink);
  font: inherit;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}

.input:hover {
  border-color: #d2d7e6;
}

.input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-wash);
  outline: none;
}

.input::placeholder {
  color: var(--ink-4);
}

textarea.input {
  min-height: 84px;
  padding: 9px 11px;
  line-height: 1.6;
  resize: vertical;
}

select.input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7590' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  display: none;
}

.switch-track {
  position: relative;
  flex: none;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #d3d8e6;
  transition: background .2s var(--ease);
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 21, 38, .26);
  content: "";
  transition: transform .2s var(--ease);
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(16, 21, 38, .06);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-dot::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.tag-blue {
  background: var(--accent-wash);
  color: var(--accent-deep);
}

.tag-mint {
  background: rgba(16, 179, 154, .12);
  color: #0a7f6d;
}

.tag-amber {
  background: rgba(240, 167, 44, .15);
  color: #96620a;
}

.tag-coral {
  background: rgba(255, 106, 77, .13);
  color: #c33c1f;
}

.tag-quiet {
  background: rgba(16, 21, 38, .05);
  color: var(--ink-3);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  padding: 34px 22px;
  color: var(--ink-4);
  text-align: center;
}

.empty-title {
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
}

.empty-text {
  max-width: 300px;
  font-size: 13px;
  line-height: 1.7;
}

.admin-subtabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--glass-edge);
  border-radius: 10px;
  background: rgba(255, 255, 255, .58);
}

.credit-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.6fr) repeat(3, minmax(82px, .7fr)) minmax(110px, .8fr) minmax(130px, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 11px;
  padding: 11px;
  border: 1px solid var(--solid-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}

.credit-user,
.credit-metric,
.image-job-row > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.credit-user b,
.image-job-row b {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-user span,
.credit-metric span,
.image-job-row span {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-metric b {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
}

.credit-adjust-input,
.credit-reason-input {
  min-width: 0;
}

.image-job-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 11px;
}

.image-job-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.6fr) minmax(90px, .7fr) minmax(170px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 11px;
  border: 1px solid var(--solid-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}

.image-job-error {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px solid var(--solid-line);
  color: var(--coral);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .credit-row {
    grid-template-columns: minmax(150px, 1.3fr) repeat(3, minmax(76px, .7fr));
  }

  .credit-adjust-input,
  .credit-reason-input,
  .credit-row .btn {
    grid-column: span 2;
  }
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 2px;
  border: 1px solid var(--glass-edge);
  border-radius: 14px;
  background: var(--glass-quiet);
}

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

.spinner-ink {
  border-color: rgba(16, 21, 38, .18);
  border-top-color: var(--accent);
}

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

/* 进入动画：面板与列表项轻微上浮 */
.rise {
  animation: rise .34s var(--ease) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
}

.fade {
  animation: fade .26s var(--ease) both;
}

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

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 380px;
  padding: 11px 14px;
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-md);
  background: var(--glass-strong);
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-line);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  animation: toast-in .28s var(--ease) both;
}

.toast-mark {
  flex: none;
  width: 4px;
  align-self: stretch;
  border-radius: 3px;
  background: var(--accent);
}

.toast-ok .toast-mark {
  background: var(--mint);
}

.toast-warn .toast-mark {
  background: var(--amber);
}

.toast-error .toast-mark {
  background: var(--coral);
}

.toast-body {
  min-width: 0;
}

.toast-title {
  font-size: 13px;
  font-weight: 600;
}

.toast-text {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 13px;
  word-break: break-word;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(16px) scale(.97);
  }
}

.toast-out {
  animation: toast-out .22s var(--ease) both;
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(14px);
  }
}
