.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--bg);
}

.card-title { font-size: 12px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.card-value { font-family: var(--mono); font-size: 24px; font-weight: 600; }
.card-foot { font-size: 12px; color: var(--fg-faint); margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.btn:hover { background: var(--accent); color: var(--accent-fg); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { opacity: 0.85; background: var(--accent); color: var(--accent-fg); }
.btn-ghost { border-color: var(--line); color: var(--fg-muted); }
.btn-ghost:hover { border-color: var(--line-strong); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--bg); }
.btn-sm { padding: 4px 8px; font-size: 12px; }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); }
.danger { color: var(--danger); }
.ok { color: var(--ok); }
.mono-sm { font-family: var(--mono); font-size: 11px; color: var(--fg-faint); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

.tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--fg-muted);
}

.field { margin-bottom: 12px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hint { font-size: 11px; color: var(--fg-faint); margin-top: 3px; }

.toast-wrap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}

.toast {
  min-width: 220px;
  max-width: 380px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 13px;
  box-shadow: none;
  animation: toast-in 0.14s ease-out;
}

.toast.error { border-color: var(--danger); color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  width: min(560px, 100%);
  max-height: 84vh;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 16px;
}

.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.dropzone {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background 0.12s;
}

.dropzone:hover, .dropzone.over { background: var(--bg-soft); }

.progress {
  height: 6px;
  background: var(--bg-sink);
  border-radius: 999px;
  overflow: hidden;
}

.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.16s linear; }

.upload-item { border-bottom: 1px solid var(--line); padding: 10px 0; }
.upload-item:last-child { border-bottom: none; }

.pager { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-top: 12px; font-size: 12px; color: var(--fg-muted); }

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}

.thumb {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
  position: relative;
}

.thumb img { display: block; width: 100%; height: 132px; object-fit: cover; background: var(--bg-sink); }
.thumb-meta { padding: 6px 8px; font-size: 11px; color: var(--fg-muted); display: flex; justify-content: space-between; gap: 6px; }
.thumb-meta .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb.sel { outline: 2px solid var(--line-strong); outline-offset: -2px; }

.ctx-menu {
  position: fixed;
  z-index: 70;
  min-width: 168px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 4px;
  font-size: 13px;
}

.ctx-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius);
}

.ctx-menu button:hover { background: var(--bg-sink); }

.empty { padding: 40px 0; text-align: center; color: var(--fg-faint); font-size: 13px; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--fg-muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12px; word-break: break-all; }

.chart { width: 100%; height: 220px; }
.chart-tall { height: 260px; }

.bar-list { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 56px; gap: 8px; align-items: center; font-size: 12px; }
.bar-track { height: 8px; background: var(--bg-sink); border-radius: 999px; overflow: hidden; }
.bar-track > i { display: block; height: 100%; background: var(--fg); }

/* 图片加载失败占位（前端会自动降级：代理 → 短链 → 占位） */
.thumb img.img-broken {
  background:
    repeating-linear-gradient(45deg, var(--line) 0 6px, transparent 6px 12px);
  border: 1px dashed var(--line);
}
.thumb[data-broken='1']::after {
  content: '加载失败';
  position: absolute;
  inset: auto 0 26px 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}
.thumb { position: relative; }
