/* 数据维护后台专用样式，复用主看板的配色与按钮 */
.hidden { display: none !important; }

.admin-body { background: var(--bg); }

.link-badge { text-decoration: none; }
.link-badge:hover { opacity: 0.8; }

.login-box { display: flex; justify-content: center; padding: 56px 16px; }
.login-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 24px; box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}
.login-card h2 { margin: 0 0 12px; }
.login-card label { display: block; margin: 14px 0 6px; font-size: 12px; color: var(--text-muted); }
.login-card input[type="text"], .login-card input[type="password"] { width: 100%; }
.check-line { display: flex !important; align-items: center; gap: 6px; font-size: 12px !important; }
.check-line input { width: auto !important; }
.login-card .btn { margin-top: 18px; width: 100%; }

.error-text { color: #d93025; font-size: 12px; min-height: 18px; margin: 8px 0 0; }

.admin-main { padding: 16px; max-width: 1600px; margin: 0 auto; }
.toolbar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  margin-bottom: 12px;
}
.toolbar .control-group { min-width: 180px; }
.toolbar .control-group.grow { flex: 1; min-width: 220px; }
.toolbar label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.toolbar select, .toolbar input { width: 100%; }
.toolbar .control-actions { margin-left: auto; flex-wrap: wrap; }

.admin-scroll { max-height: 62vh; overflow: auto; }
#admin-table { min-width: 900px; }
#admin-table td, #admin-table th { white-space: nowrap; }
#admin-table td.cell-actions { white-space: nowrap; }
#admin-table td.cell-actions button { margin-right: 6px; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 10px 2px 0; font-size: 12px; color: var(--text-muted); }
.btn.small { padding: 4px 10px; font-size: 12px; }

.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 32px 12px; overflow-y: auto;
}
.modal-card {
  background: var(--surface); border-radius: 10px; padding: 20px; width: 100%; max-width: 860px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h2 { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.form-item label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.form-item label .req { color: #d93025; }
.form-item input, .form-item textarea, .form-item select { width: 100%; }
.form-item textarea { min-height: 64px; resize: vertical; }
.form-item.full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- 批量导入 ---------- */
.import-card { max-width: 1020px; }
.import-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.step {
  flex: 1; min-width: 110px; text-align: center; padding: 7px 8px; border-radius: 6px;
  font-size: 12px; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border);
}
.step.active { color: var(--accent-dark); background: var(--accent-soft); border-color: #99f6e4; font-weight: 700; }
.step.done { color: #0f766e; background: #eef7f6; border-color: #99f6e4; }

.import-setup { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; align-items: end; }
.import-setup label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.import-setup select { width: 100%; }
.import-setup .btn { width: 100%; }
.import-card > .hint { margin: 8px 0 10px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; min-height: 118px; padding: 18px; cursor: pointer; text-align: center;
  border: 2px dashed #99f6e4; border-radius: 10px; background: #f8fafc;
}
.dropzone:hover, .dropzone.dragover { background: var(--accent-soft); border-color: var(--accent); }
.dropzone strong { font-size: 14px; }
.dropzone small { font-size: 11px; color: var(--text-muted); }
.dropzone input { display: none; }

.import-preview { margin-top: 14px; }
.preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.preview-head h3 { font-size: 14px; margin: 0 0 8px; }
.preview-scroll { max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; }
#preview-table { min-width: 640px; font-size: 12px; }
.import-warnings { max-height: 130px; overflow-y: auto; margin-top: 8px; }
.import-warnings p { margin: 2px 0; font-size: 12px; color: #b45309; }
.import-warnings p.ok { color: #0f766e; }

.import-progress { margin-top: 14px; }
.progress-track { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; border: 1px solid var(--border); }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease; }
.import-progress p { margin: 6px 0 0; }

@media (max-width: 700px) {
  .admin-main { padding: 10px; }
  .toolbar { align-items: stretch; }
  .toolbar .control-group, .toolbar .control-group.grow { min-width: 0; width: 100%; }
  .toolbar .control-actions { margin-left: 0; }
  .toolbar .control-actions .btn { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-item.full { grid-column: 1; }
  .modal { padding: 12px; }
  .modal-card { padding: 14px; }
  .admin-scroll { max-height: 70vh; }
  .import-setup { grid-template-columns: 1fr; }
  .step { min-width: 0; font-size: 11px; padding: 6px 4px; }
  .dropzone { min-height: 100px; padding: 12px; }
  .preview-scroll { max-height: 240px; }
}

/* ---------- 自定义确认弹窗（替代浏览器原生 confirm） ---------- */
.confirm-card { max-width: 420px; text-align: center; padding: 26px 24px 20px; }
.confirm-icon {
  width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%;
  background: #fff4e5; color: #d97706; font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.confirm-title { font-size: 16px; margin: 0 0 10px; }
.confirm-message {
  color: var(--text-muted); font-size: 13px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all; text-align: left;
  background: var(--bg); border-radius: 6px; padding: 10px 12px; max-height: 180px; overflow-y: auto;
}
.confirm-card .modal-actions { justify-content: center; margin-top: 18px; }
.confirm-card .modal-actions .btn { min-width: 96px; }

/* ---------- 操作反馈弹窗（居中，自动消失） ---------- */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); pointer-events: none; z-index: 100;
  min-width: 240px; max-width: 420px; padding: 22px 28px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 48px rgba(15,23,42,0.24);
  text-align: center; font-size: 14px; color: var(--text); line-height: 1.6;
}
.toast::before {
  content: '✓'; display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; margin: 0 auto 12px; border-radius: 50%;
  background: #e7f7ed; color: #16a34a; font-size: 22px; font-weight: 700;
}
.toast.error::before { content: '!'; background: #fdecea; color: #d93025; }
.toast.show { animation: toast-pop 0.22s ease-out; }
@keyframes toast-pop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---------- 确认弹窗中的 key-value 列表 ---------- */
.confirm-kv { text-align: left; background: var(--bg); border-radius: 6px; padding: 6px 12px; max-height: 220px; overflow-y: auto; }
.confirm-kv-row { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.confirm-kv-row:last-child { border-bottom: none; }
.confirm-kv-key { color: var(--text-muted); min-width: 96px; flex-shrink: 0; }
.confirm-kv-val { color: var(--text); word-break: break-all; }

/* 批量删除：复选框列 + danger 按钮 */
#admin-table th.cell-check, #admin-table td.cell-check { width: 34px; text-align: center; padding-left: 8px; padding-right: 8px; }
#admin-table .row-check, #check-all { cursor: pointer; width: 15px; height: 15px; }
.btn.danger { color: #d93025; border-color: #f0b4b0; }
.btn.danger:hover:not(:disabled) { background: #fdecea; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.danger:disabled { opacity: 0.45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent, #0f766e); outline-offset: 2px; }
