/* ==========================================================================
   管理后台样式
   --------------------------------------------------------------------------
   复用 assets/styles.css 的设计令牌与基础组件（按钮 / 弹窗 / Toast），
   这里只写后台特有的布局与表单样式。
   ========================================================================== */

/* ---------- 顶部标识 ---------- */
.admin-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: var(--radius-full);
  margin-left: 4px;
}

/* ---------- 页面容器 ---------- */
.admin {
  padding: 36px 0 60px;
}

.admin__head {
  margin-bottom: 24px;
}

.admin__head h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}

.admin__head p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 760px;
  line-height: 1.7;
}

.admin__head code {
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
}

/* ---------- 统计卡片 ---------- */
.admin__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  padding: 16px 18px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.stat-card__label {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.stat-card__value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-card__sub {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ---------- 操作栏 ---------- */
.admin__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin__dirty {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--warning);
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table thead th {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--bg-subtle);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table .ops {
  text-align: right;
  white-space: nowrap;
}

/* 资源名单元格 */
.cell-res {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 220px;
}

.cell-res__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 17px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.cell-res__text {
  min-width: 0;
}

.cell-res__title {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-res__summary {
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.cell-date {
  font-size: 12.5px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 操作按钮 */
.op-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: all var(--dur-fast) var(--ease-out);
}

.op-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.op-btn--danger:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
}

.admin__foot {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-tertiary);
}

/* ---------- 弹窗加宽 ---------- */
.modal__panel--wide {
  max-width: 760px;
}

.modal__panel--wide .modal__body {
  padding: 22px 24px;
}

/* ---------- 表单 ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form__row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}

.field--grow {
  flex: 2;
}

.field--narrow {
  flex: 0 0 120px;
}

.field > span {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.field textarea {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.field input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}

.fieldset {
  padding: 15px 16px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fieldset legend {
  padding: 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.fieldset__hint {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-tertiary);
}

.form__error {
  font-size: 13px;
  color: var(--danger);
}

.spacer {
  flex: 1;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .admin {
    padding: 24px 0 40px;
  }

  .admin__head h1 {
    font-size: 22px;
  }

  .admin__bar .btn {
    flex: 1;
    justify-content: center;
  }

  .admin__stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal__panel--wide {
    max-width: 100%;
    margin: 2dvh auto 0;
    max-height: 96dvh;
  }

  .modal__panel--wide .modal__body {
    padding: 18px;
  }

  .field--narrow {
    flex: 1 1 100%;
  }

  .cell-res__summary {
    max-width: 180px;
  }
}

/* ==========================================================================
   后台登录验证
   ========================================================================== */

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-primary);
}

.login-gate__panel {
  width: 100%;
  max-width: 380px;
  padding: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  text-align: center;
}

.login-gate__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.login-gate__brand .logo__mark {
  color: var(--brand);
  font-size: 22px;
}

.login-gate__title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.login-gate__hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.login-gate__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-gate__form .input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.login-gate__form .input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.login-gate__form .btn--block {
  width: 100%;
  height: 44px;
  justify-content: center;
}

.login-gate__error {
  min-height: 20px;
  font-size: 13px;
  color: var(--danger);
  margin: 0;
}
